Page({
  onShareAppMessage() {
    return {
      title: 'textarea',
      path: 'pages/component/textarea/textarea'
    }
  },

  data: {
    focus: false,
    curseValue: 0,
    selectionStartValue: 0,
    selectionEndValue: 0,
    boolArray: [true, false],
    boolIndex: 0,
    confirmTypeArray: ['send', 'search', 'next', 'go', 'done', 'return'],
    confirmTypeIndex: 0,
    keyboardPositionArray: ['cursor', 'bottom'],
    keyboardPositionIndex: 0,

    bindFocusFlag:'否',
    bindBlurFlag:'否',
    bindLineChangeFlag:'否',
    bindInputFlag:'否',
    bindConfirmFlag:'否',
    bindKeyboardHeightChangeFlag:'否',

    activeCursorTextarea:false,
    activeSelectionTextarea:false
  },

  bindTextAreaBlur(e) {
    console.log(e.detail.value)
  },

  bindCursor:function(e) {
    this.setData({
      curseValue: parseInt(e.detail.value)
    })
    console.log('curseValue:'+curseValue)
  },

  bindSelectionStart:function(e) {
    this.setData({
      selectionStartValue: parseInt(e.detail.value)
    })
  },

  bindSelectionEnd:function(e) {
    this.setData({
      selectionEndValue: parseInt(e.detail.value)
    })
  },

  bindBoolPickerChange: function(e) {
    console.log('bindBoolPickerChange值为', e.detail.value)
    this.setData({
      boolIndex: e.detail.value
    })
  },

  bindConfirmTypePickerChange: function(e) {
    console.log('bindConfirmTypePickerChange值为', e.detail.value)
    this.setData({
      confirmTypeIndex: e.detail.value
    })
  },

  bindKeyboardPositionPickerChange: function(e) {
    console.log('bindKeyboardPositionPickerChange', e.detail.value)
    this.setData({
      keyboardPositionIndex: e.detail.value
    })
  },

  bindFocusAction: function(e) {
    console.log('bindFocusAction值为', e.detail.value)
    this.setData({
      bindFocusFlag: '收到focus事件'
    })
  },

  bindblurAction: function(e) {
    console.log('bindblurAction值为', e.detail.value)
    this.setData({
      bindBlurFlag: '收到blur事件'
    })
  },

bindlinechangeAction: function(e) {
    console.log('bindlinechangeAction值为', e.detail.value)
    this.setData({
      bindLineChangeFlag: '收到linechange事件'
    })
  },

bindinputAction: function(e) {
    console.log('bindinputAction值为', e.detail.value)
    this.setData({
      bindInputFlag: '收到input事件'
    })

    if(e.detail.value == '123') {
      mp.hideKeyboard({
        success (res) {
          
        },
        fail (res) {},
        complete (res) {}
      })
    }
  },

  bindconfirmAction: function(e) {
    console.log('bindconfirmAction值为', e.detail.value)
    this.setData({
      bindConfirmFlag: '收到confirm事件'
    })
  },
  
  bindkeyboardheightchangeAction: function(e) {
    console.log('bindkeyboardheightchangeAction值为', e.detail.height)
    this.setData({
      bindKeyboardHeightChangeFlag: '收到keyboardheightchange事件'
    })
  },

  activeCursorTextarea:function(e) {
    this.setData({
      activeCursorTextarea:true
    })
  },

  activeSelectionTextarea:function(e) {
    this.setData({
      activeSelectionTextarea:true
    })
  }
})
